﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IronPython.Hosting;
using System.Reflection;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var engine = Python.CreateEngine();
            var scope = engine.CreateScope();
            //engine.Runtime.LoadAssembly(Assembly.GetAssembly(typeof(Program))); 
//            string pythonscript =@"
//from WebSite import *
//res = TestNamespace.TestClass.HelloString
//";
            string pythonscript = @"
import sys
sys.path.append(r'D:\RuandaoTools\Source\MiniFace\ConsoleApplication1\bin\Debug')

import clr
clr.AddReferenceToFile(""ConsoleApplication1.exe"")
from WebSite import *
res = TestNamespace.TestClass.HelloString
";
            engine.CreateScriptSourceFromString(pythonscript).Execute(scope);
            Console.WriteLine(scope.GetVariable("res"));

            Console.ReadKey();
        }
    }
}
